//// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
//package com.linqingying.gitcode.pullrequest.data.service
//
//import com.linqingying.gitcode.api.data.GCRepository
//import com.linqingying.gitcode.api.data.GCRepositoryPermissionLevel
//import com.linqingying.gitcode.api.data.GCUser
//import com.linqingying.gitcode.api.data.GitCodeUser
//import com.linqingying.gitcode.authentication.accounts.GitCodeAccount
//import com.linqingying.gitcode.util.GitCodeSharedProjectSettings
//
//class GCPRSecurityServiceImpl(private val sharedProjectSettings: GitCodeSharedProjectSettings,
//                              override val ghostUser: GCUser,
//                              override val account: GitCodeAccount,
//                              override val currentUser: GCUser,
//                              private val repo: GCRepository) : GCPRSecurityService {
//  override fun isCurrentUser(user: GitCodeUser) = user.nodeId == currentUser.id
//
//  override fun currentUserHasPermissionLevel(level: GCRepositoryPermissionLevel) =
//    (repo.viewerPermission?.ordinal ?: -1) >= level.ordinal
//
//  override fun isMergeAllowed() = repo.mergeCommitAllowed
//  override fun isRebaseMergeAllowed() = repo.rebaseMergeAllowed
//  override fun isSquashMergeAllowed() = repo.squashMergeAllowed
//
//  override fun isMergeForbiddenForProject() = sharedProjectSettings.pullRequestMergeForbidden
//}
